﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DroidClaim.Web.Service;
using DroidClaim.Web.Models;
namespace DroidClaim.Web.Mapper
{
	public class SessionInfoMapper
	{
		public static SessionInfoModel DtoToModel(SessionInfoDto inputDto) 
		{
			SessionInfoModel result = new  SessionInfoModel();

									result.Id = inputDto.Id;
											result.UpdateTime = inputDto.UpdateTime;
											result.SessionId = inputDto.SessionId;
					 
						if(inputDto.Surveyor != null)
                          {
							result.Surveyor = inputDto.Surveyor.Id;
							result.SurveyorCode = inputDto.Surveyor.Code;
							result.SurveyorName = inputDto.Surveyor.Name;
						  }
					 
						if(inputDto.Customer != null)
                          {
							result.Customer = inputDto.Customer.Id;
							result.CustomerCode = inputDto.Customer.Code;
							result.CustomerName = inputDto.Customer.Name;
						  }
											result.RegistrationId = inputDto.RegistrationId;
							
			return result;
		}

		    	
        public static SessionInfoDto ModelToDto(SessionInfoModel inputModel)
        { 
		
			SessionInfoDto result = new  SessionInfoDto
        
			{ 

									Id = inputModel.Id,
							
                
									UpdateTime = inputModel.UpdateTime,
							
                
									SessionId = inputModel.SessionId,
							
                
										 Surveyor = new SurveyorDto() {Id = inputModel.Surveyor },
				   			
                
										 Customer = new CustomerDto() {Id = inputModel.Customer },
				   			
                
									RegistrationId = inputModel.RegistrationId,
							
                
				 };
            return result;
        }

	}
}